home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / perl5000.zip / perl5000 / Makefile.SH < prev    next >
Makefile  |  1994-10-17  |  10KB  |  364 lines

  1. case $CONFIG in
  2. '')
  3.     if test -f config.sh; then TOP=.;
  4.     elif test -f ../config.sh; then TOP=..;
  5.     elif test -f ../../config.sh; then TOP=../..;
  6.     elif test -f ../../../config.sh; then TOP=../../..;
  7.     elif test -f ../../../../config.sh; then TOP=../../../..;
  8.     else
  9.         echo "Can't find config.sh."; exit 1
  10.     fi
  11.     . $TOP/config.sh
  12.     ;;
  13. esac
  14. : This forces SH files to create target in same directory as SH file.
  15. : This is so that make depend always knows where to find SH derivatives.
  16. case "$0" in
  17. */*) cd `expr X$0 : 'X\(.*\)/'` ;;
  18. esac
  19.  
  20. case "$d_dosuid" in
  21. *define*) suidperl='suidperl' ;;
  22. *) suidperl='';;
  23. esac
  24.  
  25. : Configure sets byacc=byacc if byacc is not found.  We reset it to ''
  26. case "$byacc" in
  27. ''|'byacc') byacc='';;
  28. esac
  29.  
  30. : Prepare dependency lists for Makefile.
  31. dynamic_list=' '
  32. for f in $dynamic_ext; do
  33.     : the dependency named here will never exist
  34.     dynamic_list="$dynamic_list $f.$dlext"
  35. done
  36.  
  37. static_list=' '
  38. static_ai_list=' '
  39. for f in $static_ext; do
  40.     base=`echo "$f" | sed 's/.*\///'`
  41.     static_list="$static_list ext/$f/$base.a"
  42.     if test -f ext/$f/AutoInit.c; then
  43.         static_ai_list="$static_ai_list ext/$f/AutoInit.c"
  44.     fi
  45.     if test -f ext/$f/AutoInit.pl; then
  46.         static_ai_list="$static_ai_list ext/$f/AutoInit.pl"
  47.     fi
  48. done
  49.  
  50. echo "Extracting Makefile (with variable substitutions)"
  51. $spitshell >Makefile <<'!NO!SUBS!'
  52. # Makefile.SH
  53. # This file is derived from Makefile.SH.  Any changes made here will
  54. # be lost the next time you run Configure.
  55. #  Makefile is used to generate makefile.  The only difference
  56. #  is that makefile has the dependencies filled in at the end.
  57. #
  58. !NO!SUBS!
  59.  
  60. $spitshell >>Makefile <<!GROK!THIS!
  61. # I now supply perly.c with the kits, so don't remake perly.c without byacc
  62. BYACC = $byacc
  63. CC = $cc
  64. bin = $installbin
  65. scriptdir = $scriptdir
  66. privlib = $installprivlib
  67. mansrc = $mansrc
  68. manext = $manext
  69. LDFLAGS = $ldflags
  70. CLDFLAGS = $ldflags
  71.  
  72. SMALL = $small
  73. LARGE = $large $split
  74. mallocsrc = $mallocsrc
  75. mallocobj = $mallocobj
  76. LNS = $lns
  77. RMS = rm -f
  78. ranlib = $ranlib
  79.  
  80. # The following are used to build and install shared libraries for
  81. # dynamic loading.
  82. LDDLFLAGS = $lddlflags
  83. CCDLFLAGS = $ccdlflags
  84. CCCDLFLAGS = $cccdlflags
  85. DLSUFFIX = .$dlext
  86.  
  87. dynamic_ext = $dynamic_list
  88. static_ext = $static_list
  89. ext = \$(dynamic_ext) \$(static_ext)
  90. static_ext_autoinit = $static_ai_list
  91. DYNALOADER = ext/DynaLoader/DynaLoader.a
  92.  
  93. libs = $libs $cryptlib
  94.  
  95. public = perl $suidperl
  96.  
  97. shellflags = $shellflags
  98.  
  99. ## To use an alternate make, set \$altmake in config.sh.
  100. MAKE = ${altmake-make}
  101. !GROK!THIS!
  102.  
  103. ## In the following dollars and backticks do not need the extra backslash.
  104. $spitshell >>Makefile <<'!NO!SUBS!'
  105.  
  106. CCCMD = `sh $(shellflags) cflags $(perllib) $@`
  107.  
  108. private = 
  109.  
  110. scripts =
  111.  
  112. manpages = perl.man
  113.  
  114. util =
  115.  
  116. sh = Makefile.SH cflags.SH embed_h.SH makedepend.SH makedir.SH writemain.SH
  117.  
  118. h1 = EXTERN.h INTERN.h XSUB.h av.h config.h cop.h cv.h dosish.h 
  119. h2 = embed.h form.h gv.h handy.h hv.h keywords.h mg.h op.h
  120. h3 = opcode.h patchlevel.h perl.h perly.h pp.h proto.h regcomp.h
  121. h4 = regexp.h scope.h sv.h unixish.h util.h
  122. h = $(h1) $(h2) $(h3) $(h4)
  123.  
  124. c1 = $(mallocsrc) av.c scope.c op.c doop.c doio.c dump.c hv.c mg.c
  125. c2 = perl.c perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c regcomp.c regexec.c
  126. c3 = gv.c sv.c taint.c toke.c util.c deb.c run.c
  127.  
  128. c = $(c1) $(c2) $(c3) miniperlmain.c perlmain.c
  129.  
  130. obj1 = $(mallocobj) gv.o toke.o perly.o op.o regcomp.o dump.o util.o mg.o
  131. obj2 = hv.o av.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o pp_sys.o
  132. obj3 = doop.o doio.o regexec.o taint.o deb.o 
  133.  
  134. obj = $(obj1) $(obj2) $(obj3)
  135.  
  136. # Once perl has been Configure'd and built ok you build different
  137. # perl variants (Debugging, Embedded, Multiplicity etc) by saying:
  138. #    make clean; make perllib=libperl<type>.a
  139. # where <type> is some combination of 'd' and(or) 'e' or 'm'.
  140. # See cflags to understand how this works.
  141. #
  142. # Eventually some form of 'make-a-perl' script will automate this
  143. # together with linking a perl executable with any desired
  144. # static modules.
  145. perllib = libperl.a
  146.  
  147. lintflags = -hbvxac
  148.  
  149. addedbyconf = UU
  150.  
  151. # grrr
  152. SHELL = /bin/sh
  153.  
  154. .c.o:
  155.     $(CCCMD) $*.c
  156.  
  157. all: makefile miniperl preplibrary $(public) $(dynamic_ext)
  158.     @echo " "; echo "    Making x2p stuff"; cd x2p; $(MAKE) all
  159.     @echo " "; echo "    Making docs"; cd pod; $(MAKE) all;
  160.  
  161. # Phony target to force checking subdirectories.
  162. FORCE:
  163.  
  164. !NO!SUBS!
  165.  
  166. : Now on to the rest of the Makefile.
  167. $spitshell >>Makefile <<'!NO!SUBS!'
  168. # The $& notation tells Sequent machines that it can do a parallel make,
  169. # and is harmless otherwise.
  170.  
  171. miniperl: $& miniperlmain.o $(perllib)
  172.     $(CC) $(LARGE) $(CLDFLAGS) -o miniperl miniperlmain.o $(perllib) $(libs)
  173.  
  174. perlmain.c: miniperlmain.c config.sh makefile $(static_ext_autoinit)
  175.     sh writemain $(DYNALOADER) $(static_ext) > tmp
  176.     sh mv-if-diff tmp perlmain.c
  177.  
  178. perlmain.o: perlmain.c
  179.  
  180. # The file ext.libs is a list of libraries that must be linked in
  181. # for static extensions, e.g. -lm -lgdbm, etc.  The individual
  182. # static extension Makefile's add to it.
  183. ext.libs:    $(static_ext)
  184.     -@test -f ext.libs || touch ext.libs
  185.  
  186. perl: $& perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs
  187.     $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs)
  188.  
  189. pureperl: $& perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs
  190.     purify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs)
  191.  
  192. quantperl: $& perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs
  193.     quantify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs)
  194.  
  195. $(perllib): $& perl.o $(obj)
  196.     ar rcu $(perllib) perl.o $(obj)
  197.     @$(ranlib) $(perllib)
  198.  
  199. # This version, if specified in Configure, does ONLY those scripts which need
  200. # set-id emulation.  Suidperl must be setuid root.  It contains the "taint"
  201. # checks as well as the special code to validate that the script in question
  202. # has been invoked correctly.
  203.  
  204. suidperl: $& sperl.o perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs
  205.     $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o suidperl perlmain.o sperl.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs)
  206.  
  207. sperl.o: perl.c perly.h patchlevel.h $(h)
  208.     $(RMS) sperl.c
  209.     $(LNS) perl.c sperl.c
  210.     $(CCCMD) -DIAMSUID sperl.c
  211.     $(RMS) sperl.c
  212.  
  213. opcode.h: opcode.pl
  214.     - perl opcode.pl
  215.  
  216. embed.h: embed_h.SH global.sym interp.sym
  217.     sh embed_h.SH
  218.  
  219. preplibrary: miniperl lib/Config.pm
  220.     @test -d lib/auto || mkdir lib/auto
  221.     @echo "    AutoSplitting perl library"
  222.     @./miniperl -Ilib -e 'use AutoSplit; \
  223.         autosplit_lib_modules(@ARGV)' lib/*.pm lib/*/*.pm
  224.  
  225. lib/Config.pm: config.sh miniperl
  226.     ./miniperl configpm
  227.  
  228. install: all
  229.     ./perl installperl
  230. !NO!SUBS!
  231.  
  232. : Only print out the rules for running byacc if the user _has_ byacc.
  233. : Otherwise, comment them out.  Users who really know what they are
  234. : doing can uncomment them and run yacc or bison or whatever.
  235. : Configure sets byacc=byacc if byacc is not found.
  236. case "$byacc" in
  237. ''|'byacc')
  238.     comment1='#' 
  239.     comment2='' ;;
  240. *)    comment1=''
  241.     comment2='#' ;;
  242. esac
  243.  
  244. $spitshell >>Makefile <<!GROK!THIS!
  245.  
  246. perly.h: perly.c
  247.     @ echo Dummy dependency for dumb parallel make
  248.     touch perly.h
  249.  
  250. # I now supply perly.c with the kits, so the following section is
  251. # commented out if you don't have byacc.
  252.  
  253. ${comment1}perly.c:     perly.y perly.c.diff
  254. ${comment1}    @ echo 'Expect' 109 shift/reduce and 1 reduce/reduce conflict
  255. ${comment1}    \$(BYACC) -d perly.y
  256. ${comment1}    sh \$(shellflags) ./perly.fixer y.tab.c perly.c
  257. ${comment1}    mv y.tab.h perly.h
  258. ${comment1}    echo 'extern YYSTYPE yylval;' >>perly.h
  259.  
  260. # This version is used only if you do not have byacc.
  261. ${comment2}perly.c:    perly.y
  262. ${comment2}    touch perly.c
  263.  
  264. !GROK!THIS!
  265.  
  266. $spitshell >>Makefile <<'!NO!SUBS!'
  267. # Extensions:
  268. # Names added to $(dynamic_ext) or $(static_ext) will automatically
  269. # get built.  There should ordinarily be no need to change any of 
  270. # this part of makefile.
  271. #
  272. # The dummy dependency is a place holder in case $(dynamic_ext) or
  273. # $(static_ext) is empty.
  274. #
  275. # DynaLoader may be needed for extensions that use Makefile.PL.
  276.  
  277. $(DYNALOADER):    miniperl preplibrary FORCE
  278.     @sh ext/util/make_ext static $@
  279.  
  280. d_dummy $(dynamic_ext):    miniperl preplibrary $(DYNALOADER) FORCE
  281.     @sh ext/util/make_ext dynamic $@
  282.  
  283. s_dummy $(static_ext):    miniperl preplibrary $(DYNALOADER) FORCE
  284.     @sh ext/util/make_ext static $@
  285.  
  286. clean:
  287.     rm -f *.o *.a all perl suidperl miniperl
  288.     rm -f perlmain.c
  289.     rm -f perl.exp ext.libs ext/util/extlibist
  290.     -cd x2p; $(MAKE) clean
  291.     -cd pod; $(MAKE) clean
  292.     -@for x in ext/* ; do \
  293.     if test -f $$x/Makefile; then \
  294.     echo "    Making clean in $$x"; \
  295.     cd $$x; $(MAKE) clean ; cd ../.. ; \
  296.     fi ; \
  297.     done
  298.  
  299. realclean: clean
  300.     -cd x2p; $(MAKE) realclean
  301.     -@for x in ext/* ; do \
  302.     if test -f $$x/Makefile; then \
  303.     echo "    Making realclean in $$x"; \
  304.     cd $$x; $(MAKE) realclean ; cd ../.. ; \
  305.     fi ; \
  306.     done
  307.     rm -f *.orig */*.orig *~ */*~ core t/core
  308.     rm -rf $(addedbyconf)
  309.     rm -f Makefile cflags makedepend makedir writemain
  310.     rm -f config.h t/perl makefile makefile.old
  311.     rm -f x2p/Makefile x2p/makefile x2p/makefile.old x2p/cflags
  312.     rm -f lib/Config.pm
  313.     rm -rf lib/auto
  314.     rm -f h2ph h2ph.man c2ph pstruct
  315.     rm -rf .config
  316.  
  317. # The following lint has practically everything turned on.  Unfortunately,
  318. # you have to wade through a lot of mumbo jumbo that can't be suppressed.
  319. # If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
  320. # for that spot.
  321.  
  322. lint: perly.c $(c)
  323.     lint $(lintflags) $(defs) perly.c $(c) > perl.fuzz
  324.  
  325. makefile:    Makefile
  326.     make depend
  327.  
  328. # When done, touch perlmain.c so that it doesn't get remade each time.
  329. depend: makedepend
  330.     - test -f perly.h || cp /dev/null perly.h
  331.     ./makedepend
  332.     - test -s perly.h || /bin/rm -f perly.h
  333.     - test -s perlmain.c && touch perlmain.c
  334.     cd x2p; $(MAKE) depend
  335.  
  336. test: miniperl perl preplibrary $(dynamic_ext)
  337.     - cd t && chmod +x TEST */*.t
  338.     - cd t && (rm -f perl; $(LNS) ../perl perl) && ./perl TEST </dev/tty
  339.  
  340. clist:    $(c)
  341.     echo $(c) | tr ' ' '\012' >.clist
  342.  
  343. hlist:  $(h)
  344.     echo $(h) | tr ' ' '\012' >.hlist
  345.  
  346. shlist: $(sh)
  347.     echo $(sh) | tr ' ' '\012' >.shlist
  348.  
  349. # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
  350. # If this runs make out of memory, delete /usr/include lines.
  351. !NO!SUBS!
  352.  
  353. $eunicefix Makefile
  354. case `pwd` in
  355. *SH)
  356.     $rm -f ../Makefile
  357.     ln Makefile ../Makefile
  358.     ;;
  359. esac
  360. rm -f makefile
  361.  
  362.  
  363.